package com.mmcg.listener;

import com.ruoyi.common.core.constant.CacheConstants;
import com.ruoyi.common.redis.service.RedisService;
import com.ruoyi.system.api.domain.Content;
import org.springframework.amqp.rabbit.annotation.RabbitHandler;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Component;

/**
 * 作者：李嘉浩
 * 时间：2024-09-10-14:54
 * 功能：
 */

@RabbitListener(queues = "portal_add_or_update")
@Component
public class AddListener {
    @Autowired
    private RedisService redisService;

    @RabbitHandler
    public void AddOrUpdate(Content content){
        redisService.setCacheMapValue(CacheConstants.CONTENT_MAP,content.getId()+"",content);
    }

}
